Spread Windows Forms 12.0 Product Documentation
AddChart(CellRange[],Type,Int32,Int32,Int32,Int32,ChartViewType,Boolean) Method
Example 


FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > SheetView Class > AddChart Method : AddChart(CellRange[],Type,Int32,Int32,Int32,Int32,ChartViewType,Boolean) Method
Multiple cell ranges that are used to create data for the chart.
Indicates which chart type will be added.
Width of the chart.
Height of the chart.
The x-position.
The y-position.
Type of the view.
If set to true, the new chart will have a default legend area; otherwise, there is no legend area.
Adds a chart to the SheetView. The chart will be aligned in the center of the SheetView.
Syntax
'Declaration
 
Public Overloads Function AddChart( _
   ByVal cellRanges() As CellRange, _
   ByVal seriesType As Type, _
   ByVal width As Integer, _
   ByVal height As Integer, _
   ByVal x As Integer, _
   ByVal y As Integer, _
   ByVal viewType As ChartViewType, _
   ByVal showLegend As Boolean _
) As SpreadChart
'Usage
 
Dim instance As SheetView
Dim cellRanges() As CellRange
Dim seriesType As Type
Dim width As Integer
Dim height As Integer
Dim x As Integer
Dim y As Integer
Dim viewType As ChartViewType
Dim showLegend As Boolean
Dim value As SpreadChart
 
value = instance.AddChart(cellRanges, seriesType, width, height, x, y, viewType, showLegend)
public SpreadChart AddChart( 
   CellRange[] cellRanges,
   Type seriesType,
   int width,
   int height,
   int x,
   int y,
   ChartViewType viewType,
   bool showLegend
)

Parameters

cellRanges
Multiple cell ranges that are used to create data for the chart.
seriesType
Indicates which chart type will be added.
width
Width of the chart.
height
Height of the chart.
x
The x-position.
y
The y-position.
viewType
Type of the view.
showLegend
If set to true, the new chart will have a default legend area; otherwise, there is no legend area.

Return Value

The new created instance of the chart.
Remarks
The first cell range in the cellRange array is used to generate the chart. The other cell ranges are used to generate several series and the series are added to the current chart plot area. The seriesType parameter indicates which type of chart will be added. The chartWidth and chartHeight parameters specify the size (width and height) of the chart. The absolute position is specified by the x and y parameters. The ChartViewType parameter is the view type of the chart (2D or 3D). The showLegend parameter indicates whether to show a default legend area in the chart.
Example
This example creates a chart control.
FarPoint.Win.Spread.Model.CellRange celRange1 = new FarPoint.Win.Spread.Model.CellRange(0, 0, 7, 2);
FarPoint.Win.Spread.Model.CellRange celRange2 = new FarPoint.Win.Spread.Model.CellRange(0, 2, 7, 2);
fpSpread1.Sheets[0].AddChart(new FarPoint.Win.Spread.Model.CellRange[] { celRange1, celRange2 }, typeof(FarPoint.Win.Chart.BarSeries), 400, 400, 0, 0, FarPoint.Win.Chart.ChartViewType.View2D, false);
Dim celRange1 As New FarPoint.Win.Spread.Model.CellRange(0, 0, 7, 2)
Dim celRange2 = New FarPoint.Win.Spread.Model.CellRange(0, 2, 7, 2)
fpSpread1.Sheets(0).AddChart(New FarPoint.Win.Spread.Model.CellRange() {celRange1, celRange2}, GetType(FarPoint.Win.Chart.BarSeries), 400, 400, 0, 0, FarPoint.Win.Chart.ChartViewType.View2D, False)
See Also

Reference

SheetView Class
SheetView Members
Overload List